#include <stdio.h>

int main() {
    int target;
    scanf("%d", &target);
    int counter = 1;
    int currIndex = 1;
    while (target >= currIndex + counter) {
        currIndex += counter;
        counter++;
    };
    int result = target - currIndex + 1;
    printf("%d", result);
    return 0;
}